Micron Document
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
| SparkN0de-git | SparkN0de |
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


Commit f8a79d2f51843233a513387cb9364974a39e9029


Parents : 0218ff4
Author : Mark Qvist <bc7291552be7a58f361522990465165c>
Date : 2026-05-04T12:56:31+02:00

Catch tunnel synthesis errors and log

Changes

1 files changed, 17 insertions(+), 14 deletions(-)

M RNS/Transport.py +17 -14

Diff

diff --git a/RNS/Transport.py b/RNS/Transport.py
index e083eae3..192ffdac 100755
--- a/RNS/Transport.py
+++ b/RNS/Transport.py
@@ -2222,24 +2222,27 @@ class Transport:
@staticmethod
def synthesize_tunnel(interface):
- interface_hash = interface.get_hash()
- public_key = RNS.Transport.identity.get_public_key()
- random_hash = RNS.Identity.get_random_hash()
-
- tunnel_id_data = public_key+interface_hash
- tunnel_id = RNS.Identity.full_hash(tunnel_id_data)
+ try:
+ interface_hash = interface.get_hash()
+ public_key = RNS.Transport.identity.get_public_key()
+ random_hash = RNS.Identity.get_random_hash()
+
+ tunnel_id_data = public_key+interface_hash
+ tunnel_id = RNS.Identity.full_hash(tunnel_id_data)
- signed_data = tunnel_id_data+random_hash
- signature = Transport.identity.sign(signed_data)
-
- data = signed_data+signature
+ signed_data = tunnel_id_data+random_hash
+ signature = Transport.identity.sign(signed_data)
+
+ data = signed_data+signature
- tnl_snth_dst = RNS.Destination(None, RNS.Destination.OUT, RNS.Destination.PLAIN, Transport.APP_NAME, "tunnel", "synthesize")
+ tnl_snth_dst = RNS.Destination(None, RNS.Destination.OUT, RNS.Destination.PLAIN, Transport.APP_NAME, "tunnel", "synthesize")
- packet = RNS.Packet(tnl_snth_dst, data, packet_type = RNS.Packet.DATA, transport_type = RNS.Transport.BROADCAST, header_type = RNS.Packet.HEADER_1, attached_interface = interface)
- packet.send()
+ packet = RNS.Packet(tnl_snth_dst, data, packet_type = RNS.Packet.DATA, transport_type = RNS.Transport.BROADCAST, header_type = RNS.Packet.HEADER_1, attached_interface = interface)
+ packet.send()
+
+ interface.wants_tunnel = False
- interface.wants_tunnel = False
+ except Exception as e: RNS.log(f"Could not synthesize tunnel for {interface}: {e}", RNS.LOG_ERROR)
@staticmethod
def tunnel_synthesize_handler(data, packet):


──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────